3.5.15 \(\int \frac {1}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx\) [415]

Optimal. Leaf size=70 \[ \frac {x}{c}-\frac {\left (b^2-2 a c\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {b \log \left (a+b x+c x^2\right )}{2 c^2} \]

[Out]

x/c-1/2*b*ln(c*x^2+b*x+a)/c^2-(-2*a*c+b^2)*arctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2))/c^2/(-4*a*c+b^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 70, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {1354, 717, 648, 632, 212, 642} \begin {gather*} -\frac {\left (b^2-2 a c\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {b \log \left (a+b x+c x^2\right )}{2 c^2}+\frac {x}{c} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + a/x^2 + b/x)^(-1),x]

[Out]

x/c - ((b^2 - 2*a*c)*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(c^2*Sqrt[b^2 - 4*a*c]) - (b*Log[a + b*x + c*x^2]
)/(2*c^2)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 717

Int[((d_.) + (e_.)*(x_))^(m_)/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[e*((d + e*x)^(m - 1)/(c*(
m - 1))), x] + Dist[1/c, Int[(d + e*x)^(m - 2)*(Simp[c*d^2 - a*e^2 + e*(2*c*d - b*e)*x, x]/(a + b*x + c*x^2)),
 x], x] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && NeQ[2*c*d - b*
e, 0] && GtQ[m, 1]

Rule 1354

Int[((a_) + (c_.)*(x_)^(n2_.) + (b_.)*(x_)^(n_))^(p_.), x_Symbol] :> Int[x^(2*n*p)*(c + b/x^n + a/x^(2*n))^p,
x] /; FreeQ[{a, b, c}, x] && EqQ[n2, 2*n] && LtQ[n, 0] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {1}{c+\frac {a}{x^2}+\frac {b}{x}} \, dx &=\int \frac {x^2}{a+b x+c x^2} \, dx\\ &=\frac {x}{c}+\frac {\int \frac {-a-b x}{a+b x+c x^2} \, dx}{c}\\ &=\frac {x}{c}-\frac {b \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c^2}+\frac {\left (b^2-2 a c\right ) \int \frac {1}{a+b x+c x^2} \, dx}{2 c^2}\\ &=\frac {x}{c}-\frac {b \log \left (a+b x+c x^2\right )}{2 c^2}-\frac {\left (b^2-2 a c\right ) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^2}\\ &=\frac {x}{c}-\frac {\left (b^2-2 a c\right ) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c^2 \sqrt {b^2-4 a c}}-\frac {b \log \left (a+b x+c x^2\right )}{2 c^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 73, normalized size = 1.04 \begin {gather*} \frac {x}{c}+\frac {\left (b^2-2 a c\right ) \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{c^2 \sqrt {-b^2+4 a c}}-\frac {b \log \left (a+b x+c x^2\right )}{2 c^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + a/x^2 + b/x)^(-1),x]

[Out]

x/c + ((b^2 - 2*a*c)*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/(c^2*Sqrt[-b^2 + 4*a*c]) - (b*Log[a + b*x + c*x^2
])/(2*c^2)

________________________________________________________________________________________

Maple [A]
time = 0.03, size = 75, normalized size = 1.07

method result size
default \(\frac {x}{c}+\frac {-\frac {b \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (-a +\frac {b^{2}}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}}{c}\) \(75\)
risch \(\frac {x}{c}-\frac {2 \ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}-2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) a b}{c \left (4 a c -b^{2}\right )}+\frac {\ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}-2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) b^{3}}{2 c^{2} \left (4 a c -b^{2}\right )}+\frac {\ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}-2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}}{2 c^{2} \left (4 a c -b^{2}\right )}-\frac {2 \ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}+2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) a b}{c \left (4 a c -b^{2}\right )}+\frac {\ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}+2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) b^{3}}{2 c^{2} \left (4 a c -b^{2}\right )}-\frac {\ln \left (-8 a^{2} c^{2}+6 a \,b^{2} c -b^{4}+2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}\, b \right ) \sqrt {-\left (4 a c -b^{2}\right ) \left (2 a c -b^{2}\right )^{2}}}{2 c^{2} \left (4 a c -b^{2}\right )}\) \(654\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(c+a/x^2+b/x),x,method=_RETURNVERBOSE)

[Out]

x/c+1/c*(-1/2*b/c*ln(c*x^2+b*x+a)+2*(-a+1/2/c*b^2)/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(c+a/x^2+b/x),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 235, normalized size = 3.36 \begin {gather*} \left [-\frac {{\left (b^{2} - 2 \, a c\right )} \sqrt {b^{2} - 4 \, a c} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) - 2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} x + {\left (b^{3} - 4 \, a b c\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}, -\frac {2 \, {\left (b^{2} - 2 \, a c\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) - 2 \, {\left (b^{2} c - 4 \, a c^{2}\right )} x + {\left (b^{3} - 4 \, a b c\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(c+a/x^2+b/x),x, algorithm="fricas")

[Out]

[-1/2*((b^2 - 2*a*c)*sqrt(b^2 - 4*a*c)*log((2*c^2*x^2 + 2*b*c*x + b^2 - 2*a*c + sqrt(b^2 - 4*a*c)*(2*c*x + b))
/(c*x^2 + b*x + a)) - 2*(b^2*c - 4*a*c^2)*x + (b^3 - 4*a*b*c)*log(c*x^2 + b*x + a))/(b^2*c^2 - 4*a*c^3), -1/2*
(2*(b^2 - 2*a*c)*sqrt(-b^2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*x + b)/(b^2 - 4*a*c)) - 2*(b^2*c - 4*a*c^2
)*x + (b^3 - 4*a*b*c)*log(c*x^2 + b*x + a))/(b^2*c^2 - 4*a*c^3)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 306 vs. \(2 (65) = 130\).
time = 0.32, size = 306, normalized size = 4.37 \begin {gather*} \left (- \frac {b}{2 c^{2}} - \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right ) \log {\left (x + \frac {- a b - 4 a c^{2} \left (- \frac {b}{2 c^{2}} - \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right ) + b^{2} c \left (- \frac {b}{2 c^{2}} - \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right )}{2 a c - b^{2}} \right )} + \left (- \frac {b}{2 c^{2}} + \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right ) \log {\left (x + \frac {- a b - 4 a c^{2} \left (- \frac {b}{2 c^{2}} + \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right ) + b^{2} c \left (- \frac {b}{2 c^{2}} + \frac {\sqrt {- 4 a c + b^{2}} \cdot \left (2 a c - b^{2}\right )}{2 c^{2} \cdot \left (4 a c - b^{2}\right )}\right )}{2 a c - b^{2}} \right )} + \frac {x}{c} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(c+a/x**2+b/x),x)

[Out]

(-b/(2*c**2) - sqrt(-4*a*c + b**2)*(2*a*c - b**2)/(2*c**2*(4*a*c - b**2)))*log(x + (-a*b - 4*a*c**2*(-b/(2*c**
2) - sqrt(-4*a*c + b**2)*(2*a*c - b**2)/(2*c**2*(4*a*c - b**2))) + b**2*c*(-b/(2*c**2) - sqrt(-4*a*c + b**2)*(
2*a*c - b**2)/(2*c**2*(4*a*c - b**2))))/(2*a*c - b**2)) + (-b/(2*c**2) + sqrt(-4*a*c + b**2)*(2*a*c - b**2)/(2
*c**2*(4*a*c - b**2)))*log(x + (-a*b - 4*a*c**2*(-b/(2*c**2) + sqrt(-4*a*c + b**2)*(2*a*c - b**2)/(2*c**2*(4*a
*c - b**2))) + b**2*c*(-b/(2*c**2) + sqrt(-4*a*c + b**2)*(2*a*c - b**2)/(2*c**2*(4*a*c - b**2))))/(2*a*c - b**
2)) + x/c

________________________________________________________________________________________

Giac [A]
time = 3.74, size = 67, normalized size = 0.96 \begin {gather*} \frac {x}{c} - \frac {b \log \left (c x^{2} + b x + a\right )}{2 \, c^{2}} + \frac {{\left (b^{2} - 2 \, a c\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(c+a/x^2+b/x),x, algorithm="giac")

[Out]

x/c - 1/2*b*log(c*x^2 + b*x + a)/c^2 + (b^2 - 2*a*c)*arctan((2*c*x + b)/sqrt(-b^2 + 4*a*c))/(sqrt(-b^2 + 4*a*c
)*c^2)

________________________________________________________________________________________

Mupad [B]
time = 1.42, size = 172, normalized size = 2.46 \begin {gather*} \frac {x}{c}+\frac {b^3\,\ln \left (c\,x^2+b\,x+a\right )}{2\,\left (4\,a\,c^3-b^2\,c^2\right )}-\frac {2\,a\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )}{c\,\sqrt {4\,a\,c-b^2}}+\frac {b^2\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )}{c^2\,\sqrt {4\,a\,c-b^2}}-\frac {2\,a\,b\,c\,\ln \left (c\,x^2+b\,x+a\right )}{4\,a\,c^3-b^2\,c^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(c + a/x^2 + b/x),x)

[Out]

x/c + (b^3*log(a + b*x + c*x^2))/(2*(4*a*c^3 - b^2*c^2)) - (2*a*atan(b/(4*a*c - b^2)^(1/2) + (2*c*x)/(4*a*c -
b^2)^(1/2)))/(c*(4*a*c - b^2)^(1/2)) + (b^2*atan(b/(4*a*c - b^2)^(1/2) + (2*c*x)/(4*a*c - b^2)^(1/2)))/(c^2*(4
*a*c - b^2)^(1/2)) - (2*a*b*c*log(a + b*x + c*x^2))/(4*a*c^3 - b^2*c^2)

________________________________________________________________________________________